import { MinimalButton, Position, Tooltip } from "../../core";

import { RenderShowSearchPopoverProps } from "./ShowSearchPopover";
import ShowSearchPopoverDecorator from "./ShowSearchPopoverDecorator";
import { FC } from "react";

const TOOLTIP_OFFSET = { left: 0, top: 8 };

const ShowSearchPopoverButton: FC<RenderShowSearchPopoverProps> = ({
  onClick,
}) => (
  <ShowSearchPopoverDecorator onClick={onClick}>
    {(p) => (
      <Tooltip
        position={Position.BottomCenter}
        target={<MinimalButton onClick={onClick}>{p.icon}</MinimalButton>}
        content={() => p.label}
        offset={TOOLTIP_OFFSET}
      />
    )}
  </ShowSearchPopoverDecorator>
);

export default ShowSearchPopoverButton;
